#include <iostream>
using namespace std;

int GetMonthDay(int year, int month)
{

    int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
    {
        return 29;
    }

    return monthDayArray[month];
}

int func(const int& year, const int& month, const int& day)
{
    int tmp_month = 1, result = 0;


    while (tmp_month != month)
    {
        result += GetMonthDay(year, tmp_month);
        tmp_month++;
    }

    result += day;

    return result;
}

int main()
{
    int year, month, day, result;
    cin >> year >> month >> day;

    result = func(year, month, day);

    cout << result << endl;

    return 0;
}